<template>
	<view>
		<UserInfoCard></UserInfoCard>
		<view class='page-container'>

			<template v-if="rawData && rawData.length">
				<InfoSheet v-for="(sheetData, idx) in sheetDatas" :key="idx" :sheet-data="sheetData"></InfoSheet>
			</template>
			<u-empty v-else text="暂无数据" mode="favor" style="margin-top: 100rpx;"></u-empty>
		</view>
	</view>
</template>
<script>
	import InfoSheet from '../../../components/InfoSheet/InfoSheet.vue';
	import UserInfoCard from '../../../components/UserInfo/UserInfoCard.vue';
	export default {
		components: {
			UserInfoCard,
			InfoSheet
		},
		data() {
			return {
				rawData: [{
					sheetTitle: 'XXX病区',
					patientName: '杨一帆',
					campus: 'XXXXXXXXXX',
					dept: 'XXX科',
					admissionTime: '2025-02-28'
				}],
			}
		},
		computed: {
			sheetDatas() {
				return this.transformData(this.rawData)
			}
		},
		methods: {
			// 数据转换
			transformData(rawData) {
				return rawData.map(item => ({
					sheetTitle: item.sheetTitle,
					coverBtn: '查看详情',
					fields: [{
							label: '住院患者',
							value: item.patientName
						},
						{
							label: '住院院区',
							value: item.campus
						},
						{
							label: '住院科室',
							value: item.dept
						},
						{
							label: '入院日期',
							value: item.admissionTime
						},
					]
				}));
			},
		}
	}
</script>
<style lang='scss' scoped>
	.page-container {
		/* background: linear-gradient(#e0f3ff 0%, #fff 30%); */
		/* min-height: 100vh; */
		padding: 0 16rpx;
	}
</style>